/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.user.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.user.dto.*;
import com.pig4cloud.pigx.user.entity.User;
import com.pig4cloud.pigx.user.vo.*;
import org.springframework.http.HttpHeaders;

import java.math.BigDecimal;
import java.util.List;

/**
 *
 *
 * @author pigx code generator
 * @date 2022-11-18 11:52:08
 */
public interface UserService extends IService<User> {

	/**
	 * 获取所有用户id
	 * @return r
	 */
	R<List<Long>> getAdminUserList();

	/**
	 * 获取子集用户
	 * @param type type 0 直推 1 间推
	 * @return r
	 */
	R<List<SelectUserByIdListVO>> getChildVoList(Integer type,Long userId);

	/**
	 * 管理端获取列表
	 * @param dto dto
	 * @return r
	 */
	R<Page<AdminUserPageVO>> getAdminPage(AdminUserPageDTO dto);

	/**
	 * 管理端获取用户详情
	 * @param id id
	 * @return r
	 */
	R<AdminUserTreeVO> adminGetUserDetail(Long id);

	/**
	 * 管理端添加用户
	 * @param user user
	 * @return r
	 */
	R<String> adminInsert(User user);

	/**
	 * 邮箱登录
	 * @param header header
	 * @param dto dto
	 * @return r
	 */
	R<AppUserVO> emailLogin(HttpHeaders header, EmailLoginDTO dto);

	/**
	 * 邮箱注册并登录
	 * @param header header
	 * @param dto dto
	 * @return r
	 */
	R<AppUserVO> emailRegisteredAndLogin(HttpHeaders header, RegisteredUserDTO dto);

	/**
	 * 绑定邮箱
	 * @param dto
	 * @return
	 */
	R<String> registered(RegisteredUserDTO dto);

	/**
	 * 密码解密后请求pigx-gateway中
	 *
	 * @param header header
	 * @param dto dto
	 * @return r
	 */
	R login(HttpHeaders header, UserMobileDTO dto);

	/**
	 * 用户产生燃油费的后续操作
	 * @param dto dto
	 */
	void transactionThen(TransactionThenDTO dto);

	/**
	 * 发送邮件
	 * @param dto dto
	 * @return r
	 */
	R<String> sendEmail(SendEmailDTO dto);

	/**
	 * 获取app用户余额
	 * @return r
	 */
	R<UserBalanceVO> getUserBalance();

	/**
	 * 获取登录用户信息
	 * @param id id
	 * @return
	 */
	R<AppUserDetailVO> getAppUserDetail(Long id);

	/**
	 * 修改用户资金密码
	 * @param dto dto
	 * @return r
	 */
	R<String> updateUserPassword(UpdateUserPasswordDTO dto);

	/**
	 * 修改用户邮箱
	 * @param dto dto
	 * @return r
	 */
	R<String> updateUserEmail(UpdateUserEmailDTO dto);

	/**
	 * 修改用户地址
	 * @param dto dto
	 * @param header header
	 * @return r
	 */
	R<String> updateLoginAddress(HttpHeaders header,UpdateLoginAddressDTO dto);

	/**
	 * 获取所有父级包括自己
	 * @param id id
	 * @return r
	 */
	List<User> getAllParent(Long id);

	/**
	 * 制度分成
	 *
	 * @param userId     充值用户id
	 * @param quantity   充值数量
	 * @param transferId
	 */
	void distribution(Long userId , BigDecimal quantity,Long transferId);

	/**
	 * 游客token
	 * @param header header
	 * @return r
	 */
	R<String> getTouristToken(HttpHeaders header);


}
